package br.com.webhomesites.padrao.view;

import br.com.webhomesites.configuracao.model.CidadeModel;
import br.com.webhomesites.configuracao.model.EstadoModel;
import br.com.webhomesites.configuracao.utils.ConfiguracaoInstancias;
import br.com.webhomesites.padrao.contracts.IClienteView;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.util.List;
import javax.swing.JTextField;

public class ClienteView extends javax.swing.JInternalFrame implements IClienteView {

    //construtor da classe. carrega os componentes
    public ClienteView() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rgClientePessoa = new javax.swing.ButtonGroup();
        painelCentralCliente = new javax.swing.JPanel();
        labelClienteRazaoSocial = new javax.swing.JLabel();
        txtClienteNome = new javax.swing.JTextField();
        labelClienteCodigo = new javax.swing.JLabel();
        labeClienteCNPJ = new javax.swing.JLabel();
        txtClienteCNPJ = new javax.swing.JTextField();
        txtClienteCodigo = new javax.swing.JTextField();
        labelClienteInscriacoEstadual = new javax.swing.JLabel();
        txtClienteInscricaoEstadual = new javax.swing.JTextField();
        labelClienteNome = new javax.swing.JLabel();
        txtClienteRazaoSocial = new javax.swing.JTextField();
        rbPessoaFisicaCliente = new javax.swing.JRadioButton();
        rdPessoaJuridicaCliente = new javax.swing.JRadioButton();
        labelPessoaCliente = new javax.swing.JLabel();
        labelClienteBairro = new javax.swing.JLabel();
        labelClienteEstado = new javax.swing.JLabel();
        txtClienteEndereco = new javax.swing.JTextField();
        txtClienteTelefone = new javax.swing.JTextField();
        txtClienteBairro = new javax.swing.JTextField();
        comboClienteEstado = new javax.swing.JComboBox();
        comboClienteCidade = new javax.swing.JComboBox();
        labelClienteTelefone = new javax.swing.JLabel();
        labelClienteEmail = new javax.swing.JLabel();
        labelClienteCidade = new javax.swing.JLabel();
        txtClienteEmail = new javax.swing.JTextField();
        labelClienteEndereco = new javax.swing.JLabel();
        labeClienteCpf = new javax.swing.JLabel();
        txtClienteCpf = new javax.swing.JTextField();
        labelClienteRg = new javax.swing.JLabel();
        txtClienteRg = new javax.swing.JTextField();
        txtClienteCelular = new javax.swing.JTextField();
        labelClienteCelular = new javax.swing.JLabel();
        btnNovo = new javax.swing.JButton();
        btnRemover = new javax.swing.JButton();
        btnSalvar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnPesquisar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);

        painelCentralCliente.setBorder(javax.swing.BorderFactory.createTitledBorder("Cadastro de Cliente"));
        painelCentralCliente.setPreferredSize(new java.awt.Dimension(486, 440));

        labelClienteRazaoSocial.setText("Razão Social");

        labelClienteCodigo.setText("Cód.Cliente");

        labeClienteCNPJ.setText("CNPJ");

        labelClienteInscriacoEstadual.setText("Inscrição Estadual");

        labelClienteNome.setText("Nome");

        rgClientePessoa.add(rbPessoaFisicaCliente);
        rbPessoaFisicaCliente.setText("Física");

        rgClientePessoa.add(rdPessoaJuridicaCliente);
        rdPessoaJuridicaCliente.setText("Jurídica");

        labelPessoaCliente.setText("Pessoa");

        labelClienteBairro.setText("Bairro");

        labelClienteEstado.setText("Estado");

        labelClienteTelefone.setText("Telefone");

        labelClienteEmail.setText("E-mail");

        labelClienteCidade.setText("Cidade");

        labelClienteEndereco.setText("Endereço");

        labeClienteCpf.setText("CPF");

        labelClienteRg.setText("RG");

        labelClienteCelular.setText("Celular");

        javax.swing.GroupLayout painelCentralClienteLayout = new javax.swing.GroupLayout(painelCentralCliente);
        painelCentralCliente.setLayout(painelCentralClienteLayout);
        painelCentralClienteLayout.setHorizontalGroup(
            painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtClienteTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelClienteTelefone))
                                .addGap(14, 14, 14)
                                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtClienteCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelClienteCelular)))
                            .addComponent(labelClienteRg)
                            .addComponent(txtClienteRg, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(14, 14, 14)
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtClienteEmail)
                            .addComponent(txtClienteInscricaoEstadual)
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelClienteEmail)
                                    .addComponent(labelClienteInscriacoEstadual))
                                .addGap(0, 128, Short.MAX_VALUE))))
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(comboClienteCidade, javax.swing.GroupLayout.Alignment.LEADING, 0, 225, Short.MAX_VALUE)
                            .addComponent(comboClienteEstado, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(labelClienteEndereco, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtClienteEndereco, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(14, 14, 14)
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelClienteBairro)
                            .addComponent(txtClienteBairro)))
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(labelClienteCodigo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(txtClienteCodigo))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                        .addComponent(rbPessoaFisicaCliente)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(rdPessoaJuridicaCliente))
                                    .addComponent(labelPessoaCliente)))
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addComponent(labelClienteNome)
                                .addGap(212, 212, 212)
                                .addComponent(labelClienteRazaoSocial))
                            .addComponent(labelClienteEstado)
                            .addComponent(labelClienteCidade))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addComponent(txtClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(14, 14, 14)
                        .addComponent(txtClienteRazaoSocial))
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addComponent(labeClienteCpf)
                                .addGap(212, 212, 212))
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addComponent(txtClienteCpf)
                                .addGap(6, 6, 6)))
                        .addGap(8, 8, 8)
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtClienteCNPJ)
                            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                                .addComponent(labeClienteCNPJ)
                                .addGap(0, 0, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        painelCentralClienteLayout.setVerticalGroup(
            painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCentralClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(labelClienteRazaoSocial))
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(labelClienteCodigo)
                            .addComponent(labelPessoaCliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtClienteCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(rbPessoaFisicaCliente)
                            .addComponent(rdPessoaJuridicaCliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
                        .addComponent(labelClienteNome)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtClienteNome)
                    .addComponent(txtClienteRazaoSocial))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtClienteCNPJ, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(painelCentralClienteLayout.createSequentialGroup()
                        .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(labeClienteCpf)
                            .addComponent(labeClienteCNPJ))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtClienteCpf)))
                .addGap(8, 8, 8)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelClienteRg)
                    .addComponent(labelClienteInscriacoEstadual))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtClienteRg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtClienteInscricaoEstadual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelClienteTelefone)
                    .addComponent(labelClienteEmail)
                    .addComponent(labelClienteCelular))
                .addGap(7, 7, 7)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtClienteTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtClienteEmail)
                    .addComponent(txtClienteCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelClienteEndereco)
                    .addComponent(labelClienteBairro))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtClienteEndereco)
                    .addComponent(txtClienteBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelClienteEstado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboClienteEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addComponent(labelClienteCidade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboClienteCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        btnNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/document-icon.png"))); // NOI18N
        btnNovo.setMnemonic('n');

        btnRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/delete-icon.png"))); // NOI18N
        btnRemover.setMnemonic('x');

        btnSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/save-icon.png"))); // NOI18N
        btnSalvar.setMnemonic('s');

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/block-icon.png"))); // NOI18N
        btnCancelar.setMnemonic('c');

        btnPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/search-icon.png"))); // NOI18N
        btnPesquisar.setMnemonic('p');

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnRemover, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(painelCentralCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelCentralCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(11, 11, 11)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnSalvar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnRemover, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnCancelar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnPesquisar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnNovo;
    private javax.swing.JButton btnPesquisar;
    private javax.swing.JButton btnRemover;
    private javax.swing.JButton btnSalvar;
    private javax.swing.JComboBox comboClienteCidade;
    private javax.swing.JComboBox comboClienteEstado;
    private javax.swing.JLabel labeClienteCNPJ;
    private javax.swing.JLabel labeClienteCpf;
    private javax.swing.JLabel labelClienteBairro;
    private javax.swing.JLabel labelClienteCelular;
    private javax.swing.JLabel labelClienteCidade;
    private javax.swing.JLabel labelClienteCodigo;
    private javax.swing.JLabel labelClienteEmail;
    private javax.swing.JLabel labelClienteEndereco;
    private javax.swing.JLabel labelClienteEstado;
    private javax.swing.JLabel labelClienteInscriacoEstadual;
    private javax.swing.JLabel labelClienteNome;
    private javax.swing.JLabel labelClienteRazaoSocial;
    private javax.swing.JLabel labelClienteRg;
    private javax.swing.JLabel labelClienteTelefone;
    private javax.swing.JLabel labelPessoaCliente;
    private javax.swing.JPanel painelCentralCliente;
    private javax.swing.JRadioButton rbPessoaFisicaCliente;
    private javax.swing.JRadioButton rdPessoaJuridicaCliente;
    private javax.swing.ButtonGroup rgClientePessoa;
    private javax.swing.JTextField txtClienteBairro;
    private javax.swing.JTextField txtClienteCNPJ;
    private javax.swing.JTextField txtClienteCelular;
    private javax.swing.JTextField txtClienteCodigo;
    private javax.swing.JTextField txtClienteCpf;
    private javax.swing.JTextField txtClienteEmail;
    private javax.swing.JTextField txtClienteEndereco;
    private javax.swing.JTextField txtClienteInscricaoEstadual;
    private javax.swing.JTextField txtClienteNome;
    private javax.swing.JTextField txtClienteRazaoSocial;
    private javax.swing.JTextField txtClienteRg;
    private javax.swing.JTextField txtClienteTelefone;
    // End of variables declaration//GEN-END:variables

    @Override
    public void setCodigo(int codigo) {
        this.txtClienteCodigo.setText((Integer.toString(codigo)));
    }

    @Override
    public int getCodigo() {
        return Integer.parseInt(txtClienteCodigo.getText());
    }

    @Override
    public void setPessoa(String pessoa) {
        //this.rgClientePessoa.setSelected();
    }

    @Override
    public String getPessoa() {
        return this.rgClientePessoa.getSelection().getActionCommand();
    }

    @Override
    public void setNome(String nome) {
        this.txtClienteNome.setText(nome);
    }

    @Override
    public String getNome() {
        return this.txtClienteNome.getText();
    }

    @Override
    public void setCpf(String cpf) {
        this.txtClienteCpf.setText(cpf);
    }

    @Override
    public String getCpf() {
        return this.txtClienteCpf.getText();
    }

    @Override
    public void setRg(String rg) {
        this.txtClienteRg.setText(rg);
    }

    @Override
    public String getRg() {
        return this.txtClienteRg.getText();
    }

    @Override
    public void setCelular(String celular) {
        this.txtClienteCelular.setText(celular);
    }

    @Override
    public String getCelular() {
        return this.txtClienteCelular.getText();
    }

    @Override
    public void setRazaoSocial(String razaoSocial) {
        this.txtClienteRazaoSocial.setText(razaoSocial);
    }

    @Override
    public String getRazaoSocial() {
        return txtClienteRazaoSocial.getText();
    }

    @Override
    public void setCnpj(String cnpj) {
        this.txtClienteCNPJ.setText(cnpj);
    }

    @Override
    public String getCnpj() {
        return txtClienteCNPJ.getText();
    }

    @Override
    public void setInscricaoEstadual(String inscricaoEstadual) {
        this.txtClienteInscricaoEstadual.setText(inscricaoEstadual);
    }

    @Override
    public String getInscricaoEstadual() {
        return txtClienteInscricaoEstadual.getText();
    }

    @Override
    public void setEndereco(String endereco) {
        this.txtClienteEndereco.setText(endereco);
    }

    @Override
    public String getEndereco() {
        return txtClienteEndereco.getText();
    }

    @Override
    public void setBairro(String bairro) {
        this.txtClienteBairro.setText(bairro);
    }

    @Override
    public String getBairro() {
        return txtClienteBairro.getText();
    }

    @Override
    public void setCidade(List<CidadeModel> listaCidades) {

        for (int i = 0; i < listaCidades.size(); i++) // Percorro o Array List com o For aprimorado.  
        {
            this.comboClienteCidade.addItem(listaCidades.get(i).getNomeCidade()); // Adiciono os dados.  
        }
    }

    @Override
    public String getCidade() {
        return comboClienteCidade.getSelectedItem().toString();
    }

    @Override
    public void setEstado(List<EstadoModel> listaEstados) {

        for (int i = 0; i < listaEstados.size(); i++) // Percorro o Array List com o For aprimorado.  
        {
            this.comboClienteEstado.addItem(listaEstados.get(i).getNomeEstado()); // Adiciono os dados.  
        }
    }

    @Override
    public String getEstado() {
        return comboClienteEstado.getSelectedItem().toString();
    }

    @Override
    public void setTelefone(String telefone) {
        this.txtClienteTelefone.setText(telefone);
    }

    @Override
    public String getTelefone() {
        return txtClienteTelefone.getText();
    }

    @Override
    public void setEmail(String email) {
        this.txtClienteEmail.setToolTipText(email);
    }

    @Override
    public String getEmail() {
        return txtClienteEmail.getText();
    }

    @Override
    public void packAndShow() {
        //this.pack();  
        ConfiguracaoInstancias.getDesktop().getDesktop().add(this);
        this.setVisible(true);
    }

    @Override
    public void clearFields() {
        Component[] componentesPainel;
        componentesPainel = painelCentralCliente.getComponents();
        for (int j = 0; j < componentesPainel.length; j++) {
            if (componentesPainel[j] instanceof JTextField) {
                JTextField field = (JTextField) componentesPainel[j];
                field.setText("");
            }
        }
    }

    @Override
    public void enableTxtClienteCodigo(boolean arg) {
        txtClienteCodigo.setEnabled(arg);
    }

    @Override
    public void enableRgClientePessoa(boolean arg) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void enableTxtClienteNome(boolean arg) {
        this.txtClienteNome.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteCpf(boolean arg) {
        this.txtClienteCpf.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteRg(boolean arg) {
        this.txtClienteRg.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteCelular(boolean arg) {
        this.txtClienteCelular.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteRazaoSocial(boolean arg) {
        txtClienteNome.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteCnpj(boolean arg) {
        txtClienteCNPJ.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteInscricaoEstadual(boolean arg) {
        txtClienteInscricaoEstadual.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteEndereco(boolean arg) {
        txtClienteEndereco.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteBairro(boolean arg) {
        txtClienteBairro.setEnabled(arg);
    }

    @Override
    public void enableComboClienteCidade(boolean arg) {
        comboClienteCidade.setEnabled(arg);
    }

    @Override
    public void enableComboClienteEstado(boolean arg) {
        comboClienteEstado.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteTelefone(boolean arg) {
        txtClienteTelefone.setEnabled(arg);
    }

    @Override
    public void enableTxtClienteEmail(boolean arg) {
        txtClienteEmail.setEnabled(arg);
    }

    @Override
    public void enableBtnAlterar(boolean arg) {
        this.btnPesquisar.setEnabled(arg);
    }

    @Override
    public void enableBtnRemover(boolean arg) {
        this.btnRemover.setEnabled(arg);
    }

    @Override
    public void enableBtnCancelar(boolean arg) {
        this.btnCancelar.setEnabled(arg);
    }

    @Override
    public void enableBtnSalvar(boolean arg) {
        this.btnSalvar.setEnabled(arg);
    }

    @Override
    public void enableBtnInserir(boolean arg) {
        this.btnNovo.setEnabled(arg);
    }

    @Override
    public void setInserirActionListener(ActionListener listener) {
        this.btnNovo.addActionListener(listener);
    }

    @Override
    public void setRemoverActionListener(ActionListener listener) {
        this.btnRemover.addActionListener(listener);
    }

    @Override
    public void setAlterarActionListener(ActionListener listener) {
        this.btnPesquisar.addActionListener(listener);
    }

    @Override
    public void setCancelarActionListener(ActionListener listener) {
        this.btnCancelar.addActionListener(listener);
    }

    @Override
    public void setSalvarActionListener(ActionListener listener) {
        this.btnSalvar.addActionListener(listener);
    }

    @Override
    public void setBtnSairActionListener(ActionListener listener) {
        //this.btnSair.addActionListener(listener); 
    }

    @Override
    public void removeAllitensComboClienteCidade() {
        this.comboClienteCidade.removeAllItems();
    }

    @Override
    public void removeAllitensComboClienteEstado() {
        this.comboClienteEstado.removeAllItems();
    }

    @Override
    public void setMascaraListener(KeyListener listener) {
        this.txtClienteCNPJ.addKeyListener(listener);
        this.txtClienteCpf.addKeyListener(listener);
        this.txtClienteRg.addKeyListener(listener);
        this.txtClienteTelefone.addKeyListener(listener);
        this.txtClienteCelular.addKeyListener(listener);
    }
}
